import react,{useState,useEffect}  from 'react'
import './App.css';


function App() {
  const [testname,setTestName] = useState(0)
  return (
    <div className="App">
       <div className="count">count：{testname}</div>
       <button onClick={handleAdd}>加一</button>
       <button onClick={handleReduce}>减一</button>
       <button onClick={()=>{setTestName(0)}}>重置</button>
       <button onClick={()=>{setTestName(()=>{return  Math.random()*10})}}>赋个随机值</button>
    </div>
  );
  function handleAdd(){
    setTestName(testname+1)
  }
  function handleReduce(){
    setTestName(testname-1)
  }
}

export default App;
